package architecture.users;

import java.util.*;

public class User {

	public String userName, email, password;
	HashSet<String> rights;
	
	public User(String userName, Vector<String> rights)
	{
		this.userName = userName;
		//System.out.println(rights);
		this.rights = new HashSet<String>(rights);
	}
	
	public boolean haveRights(String right)
	{
		return rights.contains(right);
	}
	
	public int haveRightsOverTable(String table)
	{
		return ((rights.contains("TABLE_READ")?4:0)+
				(rights.contains("TABLE_WRITE")?2:0)+
				(rights.contains("TABLE_MODIFY")?1:0));
	}
	
	@Override
	public String toString()
	{
		return rights.toString();
	}

}
